<?php

namespace app\admin\model;


use think\Db;
use think\Model;

class Product extends Model
{
    protected $autoWritrTimestamp=true;
    public function setUpcAttr($value){
        return uniqid();
    }
    public function getImageThumbAttr($value){
        if(!empty($value)){
            return 'http://malladmin.alixi.cn/uploads/product/'.$value;
        }else{
            return $value;
        }
    }
    public function setImageThumbAttr($value)
    {
        $index = strpos($value, 'thumb');
        $res = substr($value, $index);
        return $res;
    }
    public function upda($where,$data){
        return Db::name('Product')->where($where)->update($data);
    }
}